<?php
class Reale_Model_Estate_Brokerage {
    
    /**
     * 
     * Enter description here ...
     * @var int
     */
    protected $_estate_id;
    
    /**
     * 
     * Enter description here ...
     * @var int
     */
    protected $_from;
    
    /**
     * 
     * Enter description here ...
     * @var int
     */
    protected $_upto;
    
    /**
     * 
     * Enter description here ...
     * @var int
     */
    protected $_brokerage;
    
    

    /**
     * @return int $_estate_id
     */
    public function getEstate_id ()
    {
        return $this->_estate_id;
    }

	/**
     * @param int $_estate_id
     * @return Reale_Model_Estate_Brokerage
     */
    public function setEstate_id ($_estate_id)
    {
        $this->_estate_id = $_estate_id;
        return $this;
    }

	/**
     * @return int $_from
     */
    public function getFrom ()
    {
        return $this->_from;
    }

	/**
     * @param int $_from
     * @return Reale_Model_Estate_Brokerage
     */
    public function setFrom ($_from)
    {
        $this->_from = $_from;
        return $this;
    }

	/**
     * @return int $_upto
     */
    public function getUpto ()
    {
        return $this->_upto;
    }

	/**
     * @param int $_upto
     * @return Reale_Model_Estate_Brokerage
     */
    public function setUpto ($_upto)
    {
        $this->_upto = $_upto;
        return $this;
    }

	/**
     * @return the $_brokerage
     */
    public function getBrokerage ()
    {
        return $this->_brokerage;
    }

	/**
     * @param int $_brokerage
     * @return Reale_Model_Estate_Brokerage
     */
    public function setBrokerage ($_brokerage)
    {
        $this->_brokerage = $_brokerage;
        return $this;
    }

	/**
     * Constructor
     * 
     * @param  array|null $options 
     * @return void
     */
    public function __construct (array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
        /*
        if (isset($options['agent_reg_id'])) {
            self::isValid();
        }*/
    }
    /**
     * Overloading: allow property access
     * 
     * @param  string $name 
     * @param  mixed $value 
     * @return void
     */
    public function __set ($name, $value)
    {
        $method = 'set' . ucfirst($name);
        if ('mapper' == $name || ! method_exists($this, $method)) {
            throw new Exception('Invalid property specified', Zend_Log::DEBUG);
        }
        $this->$method($value);
    }
    /**
     * Overloading: allow property access
     * 
     * @param  string $name 
     * @return mixed
     */
    public function __get ($name)
    {
        $method = 'get' . ucfirst($name);
        if ('mapper' == $name || ! method_exists($this, $method)) {
            throw new Exception('Invalid property specified', Zend_Log::DEBUG);
        }
        return $this->$method();
    }
    /**
     * Set state
     * 
     * @param  array $options 
     * @return Reale_Model_Estate_Brokerage
     */
    public function setOptions (array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
    

    /**
     * Set object to array
     * 
     * @return array
     */
    public function __toArray()
    {
        $data = array();
        $methods = get_class_methods($this);
        foreach ($methods as $key => $method) {
            if ('get' == substr($method, 0,3)) {
                $output = $this->$method();
                if (is_array($output) || is_string($output)) {
                    $newKey = strtolower(substr($method, 3));
                    $data[$newKey] = $output;
                }
            };
        }
        return $data;
    }
}